<%
sub login(username, password)
	set conn=server.createobject("adodb.connection")
	conn.open "provider=microsoft.jet.oledb.4.0;data source="&server.mappath("App_Data\MainDB.mdb")
	set rs=server.createobject("adodb.recordset")
	rs.open "SELECT * FROM [Users] WHERE UserName='" & username & "' AND PWD='" & password & "'",conn,3,3
	if rs.eof then
		response.Write("用户名或密码错误！")
	else
		session("username")=username
		session("password")=password
		session("usergrade")=rs("UserGrade")
		response.Write("欢迎归来，" & username & "。")
	end if
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
end sub
function chklogin()
	if session("username")<>"" then
		chklogin=true
	else
		chklogin=false
	end if
end function
function chkadmin()
	if session("usergrade")<16 then
		chkadmin=false
	else
		chkadmin=true
	end if
end function
%>
